﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbRenderGlobal : OdDbObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbRenderGlobal(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbRenderGlobal_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbRenderGlobal obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbRenderGlobal()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbRenderGlobal(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbRenderGlobal cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbRenderGlobal_cast(OdRxObject.getCPtr(pObj));
			OdDbRenderGlobal result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRenderGlobal_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRenderGlobal_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRenderGlobal_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbRenderGlobal createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbRenderGlobal_createObject();
			OdDbRenderGlobal result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbRenderGlobal)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setProcedureAndDestination(OdDbRenderGlobal.Procedure nProcedure, OdDbRenderGlobal.Destination nDestination)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_setProcedureAndDestination(this.swigCPtr, (int)nProcedure, (int)nDestination);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void procedureAndDestination(SWIGTYPE_p_OdDbRenderGlobal__Procedure nProcedure, SWIGTYPE_p_OdDbRenderGlobal__Destination nDestination)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_procedureAndDestination(this.swigCPtr, SWIGTYPE_p_OdDbRenderGlobal__Procedure.getCPtr(nProcedure), SWIGTYPE_p_OdDbRenderGlobal__Destination.getCPtr(nDestination));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdResult setProcedure(OdDbRenderGlobal.Procedure nProcedure)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_setProcedure(this.swigCPtr, (int)nProcedure);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdDbRenderGlobal.Procedure procedure()
		{
			OdDbRenderGlobal.Procedure result = (OdDbRenderGlobal.Procedure)TD_DbPINVOKE.OdDbRenderGlobal_procedure(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult setDestination(OdDbRenderGlobal.Destination nDestination)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_setDestination(this.swigCPtr, (int)nDestination);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdDbRenderGlobal.Destination destination()
		{
			OdDbRenderGlobal.Destination result = (OdDbRenderGlobal.Destination)TD_DbPINVOKE.OdDbRenderGlobal_destination(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setSaveEnabled(bool bEnabled)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_setSaveEnabled(this.swigCPtr, bEnabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool saveEnabled()
		{
			bool result = TD_DbPINVOKE.OdDbRenderGlobal_saveEnabled(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult setSaveFileName(string sFileName)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_setSaveFileName(this.swigCPtr, sFileName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string saveFileName()
		{
			string result = TD_DbPINVOKE.OdDbRenderGlobal_saveFileName(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult setDimensions(int w, int h)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_setDimensions(this.swigCPtr, w, h);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void dimensions(out int w, out int h)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_dimensions(this.swigCPtr, out w, out h);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setPredefinedPresetsFirst(bool bPredefinedPresetsFirst)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_setPredefinedPresetsFirst(this.swigCPtr, bPredefinedPresetsFirst);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool predefinedPresetsFirst()
		{
			bool result = TD_DbPINVOKE.OdDbRenderGlobal_predefinedPresetsFirst(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setHighInfoLevel(bool bHighInfoLevel)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_setHighInfoLevel(this.swigCPtr, bHighInfoLevel);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool highInfoLevel()
		{
			bool result = TD_DbPINVOKE.OdDbRenderGlobal_highInfoLevel(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult setExposureType(OdGiMrExposureType type)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_setExposureType(this.swigCPtr, (int)type);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiMrExposureType exposureType()
		{
			OdGiMrExposureType result = (OdGiMrExposureType)TD_DbPINVOKE.OdDbRenderGlobal_exposureType(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string dimensionName()
		{
			string result = TD_DbPINVOKE.OdDbRenderGlobal_dimensionName(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRenderGlobal_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbRenderGlobal_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum Procedure
		{
			krView,
			krCrop,
			krSelected
		}

		public enum Destination
		{
			krWindow,
			krViewport
		}
	}
}
